﻿using UnityEngine;
using System.Collections.Generic;

public class TweenAction : MonoBehaviour {
    private List<TweenActionBase> actionList=new List<TweenActionBase>();
	private bool ended;
	void Start () {
	}
	
	void Update () {
        int i = 0;
	    for(;i< actionList.Count;)
        {
            actionList[i].Step(Time.deltaTime);
            if(actionList[i].IsEnded())
            {
                actionList.RemoveAt(i);
            }
            else
            {
                i++;
            }
        }
	}
    
    public void RunAction(TweenActionBase action)
    {
        actionList.Add(action);
    }

    public bool IsPlaying()
    {
        return actionList.Count != 0;
    }

    public void StopAllActions()
    {
        actionList.Clear();
    }
}
